﻿@model HdipCricketClub.ViewModels.ScorecardAbandonedFixtureReInputTeamsViewModel

@{
    ViewBag.Title = "ReInputAbandonedFixtureTeamDetailsBatAndBowlBattedSecond";
}

<h2>Re Input Abandoned Fixture Team Details Bat And Bowl, Batted Second</h2>

@using (@Html.BeginForm("EnterScoresBatAndBowlBattedSecond", "ScorecardAbandonedFixture", FormMethod.Post))
{
<fieldset>
<legend>Fixture</legend>
<br/>
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.fixture_id)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.team_id)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.opponent_id)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.type)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.home)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.date)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.start_time)
@Html.HiddenFor(ModelItem => Model.ScorecardFixture.no_of_players)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.fixture_id)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.result_id)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.scorecard_entered)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.won_toss)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.batted_first)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.batted)
@Html.HiddenFor(ModelItem => Model.ScorecardHeaderDetail.bowled)

@Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.name)
vs @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.team_name)
<br/>
Played on: @Html.DisplayFor(ModelItem => Model.ScorecardFixture.date)
<br/>
At:
@if (Model.ScorecardFixture.home)
{
    @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName)
}
else
{
    @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name)
}
<br/><br/>
@if (Model.ScorecardHeaderDetail.won_toss)
{
    @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName)
    @:won the toss and elected to bat.
}
else
{
    @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name)
    @:won the toss and elected to field first.
}
</fieldset>

<fieldset>
<legend>@Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name) Team</legend>
<br />
@if (Model.OpponentBatsmenErrorMessages.Count() != 0)
{
    <span class="team_input_error_header">Please correct the following batsman errors</span><br/>
    foreach (var item in Model.OpponentBatsmenErrorMessages)
    {
        <span class="team_input_error">@Html.DisplayFor(modelItem => item)</span><br/>
    }
}
@if (Model.OpponentBowlersErrorMessages.Count() != 0)
{
    <span class="team_input_error_header">Please correct the following bowler number errors</span><br/>
    foreach (var item in Model.OpponentBowlersErrorMessages)
    {
        <span class="team_input_error">@Html.DisplayFor(modelItem => item)</span><br/>
    }
}
<br/>
<table>
    <tr>
        <th>
            Batsman No:
        </th>
        <th>
            Name
        </th>
        <th>
            Bowler No:
        </th>
    </tr>
    @foreach (var item in Model.ScorecardOpponentPlayers)
    {
        <tr>
            @Html.HiddenFor(modelItem => item.op_fixture_id)
            @Html.HiddenFor(modelItem => item.op_batsman_number)
            <td>
                @Html.DisplayFor(modelItem => item.op_batsman_number)
            </td>
            <td>
                @Html.EditorFor(modelItem => item.op_player_name)
            </td>
            <td>
                @Html.EditorFor(modelItem => item.op_bowler_number)
            </td>
         </tr>
        
    }
    
</table>
</fieldset>
    <fieldset>
<legend>@Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName) Team</legend>
<br/>
@if (Model.ClubBatsmenErrorMessages.Count() != 0)
{
    <span class="team_input_error_header">Please correct the following batsman number errors</span><br/>
    foreach (var item in Model.ClubBatsmenErrorMessages)
    {
        <span class="team_input_error">@Html.DisplayFor(modelItem => item)</span><br/>
    }
}
@if (Model.ClubBowlersErrorMessages.Count() != 0)
{
    <span class="team_input_error_header">Please correct the following bowler number errors</span><br/>
    foreach (var item in Model.ClubBowlersErrorMessages)
    {
        <span class="team_input_error">@Html.DisplayFor(modelItem => item)</span><br/>
    }
}
<br/>
<table>
    <tr>
        <th></th>
        <th>
            Name
        </th>
        <th>
            Batsman No:
        </th>
        <th>
            Bowler No:
        </th>
    </tr>
    @{int i = 1;}
    @foreach (var item in Model.ScorecardClubPlayers)
    {
        <tr>
            @Html.HiddenFor(modelItem => item.fixture_id)
            @Html.HiddenFor(modelItem => item.player_id)
            <td>
                @i
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Member.InitialAndLastName)
            </td>
            <td>
                @Html.EditorFor(modelItem => item.batsman_number)
            </td>
            <td>
                @Html.EditorFor(modelItem => item.bowler_number)
            </td>
         </tr>
        i++;
    }
    
</table>
</fieldset>
    <p>
        <input type="submit" value="Submit" /> 
    </p>
}

